package 其他;

import java.util.ArrayList;
import java.util.Scanner;

/*
样例输入
    1-a,2-b,3-c
    1-a,2-bb,3-c
样例输出
    modify-2

提示
输入：
    1-a,2-b,3-c
    1-a,2-bb
输出:
    modify-2,delete-3


输入：
    1-a
    1-a,2-b
输出:
    add-2
 */
public class test05 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        String[] strArray1 = str1.split(",");
        String[] strArray2 = str2.split(",");
        ArrayList<String> list = new ArrayList<>();
        int MinLength = 0,MaxLength = 0;
        if(strArray1.length >= strArray2.length) {
            MinLength = strArray2.length;
            MaxLength = strArray1.length;
        }
        else {
            MinLength = strArray1.length;
            MaxLength = strArray2.length;
        }
        for (int i = 0; i < MinLength; i++) {
            String[] strArray12 = strArray1[i].split("-");
            String[] strArray22 = strArray2[i].split("-");
            if (strArray12[0].equals(strArray22[0])) {
                if (!strArray12[1].equals(strArray22[1])) {
                    list.add("modify-" + strArray12[0]);
                }
            }

        }
        for (int i = MinLength; i < MaxLength; i++) {
            if(MinLength == strArray1.length) {
                String[] strArray22 = strArray2[i].split("-");
                list.add("add-" + strArray22[0]);
            }
            else {
                String[] strArray12 = strArray1[i].split("-");
                list.add("delete-" + strArray12[0]);
            }
        }
        for (int i = 0; i < list.size(); i++) {
            if(i == list.size() - 1)
                System.out.print(list.get(i));
            else
                System.out.print(list.get(i) + ",");
        }
    }

}
